﻿<UserControl x:Class="CYPlayer.ProjectViews.MediaLibView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:viewmodel="clr-namespace:CYPlayer.ViewModel" mc:Ignorable="d" 
             d:DesignHeight="410" d:DesignWidth="680">
    <UserControl.DataContext>
        <viewmodel:MediaLibWindowVM/>
    </UserControl.DataContext>
    <Grid Height="410"  Width="680">
        <Grid Background="{DynamicResource MyBackTitleBrush}">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="*"/>
                <RowDefinition Height="9*"/>
                <RowDefinition Height="3*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="5*"></ColumnDefinition>
                <ColumnDefinition Width="2*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Border Grid.Row="0" Background="PaleTurquoise" Grid.ColumnSpan="2">
                <TextBlock TextAlignment="Center" FontFamily="Segoe UI" FontSize="16">MediaLibrary</TextBlock>
            </Border>
            <DockPanel Grid.Row="1">
                <TextBox Width="200" Height="20" Margin="5,0,0,0" DockPanel.Dock="Left"></TextBox>
                <Button Width="100" DockPanel.Dock="Left" Margin="5,5,0,5">Search</Button>
                <Button Width="100" DockPanel.Dock="Left" Margin="5,5,0,5">Scan</Button>
            </DockPanel>
            <StackPanel Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Center" >
                <StackPanel Orientation="Horizontal" Height="35">
                    <Button Width="30" Margin="5,5,5,5">
                        <Grid HorizontalAlignment="Center">
                            
                            <Path Fill="White" Stroke="Black" StrokeThickness="1" Margin="2" Data="M0,0 8,0 14,6 14,17 0,17 0,0 Z "></Path>
                            <Path Fill="White" Stroke="Black" StrokeThickness="1" Margin="2" Data="M8,0 8,6 14,6  "></Path>
                        </Grid>
                    </Button>
                    <TextBlock FontSize="20" Width="110" Height="30" Foreground="White" TextAlignment="Center">Playlist</TextBlock>
                    <Button Width="30" Margin="5,5,5,5" >
                        <Grid HorizontalAlignment="Center">
                            <Path Fill="White" Stroke="Black" StrokeThickness="0.3"
                              Data="M1,1 4,1 4,11 15,11 15,1 17,1 22,6 22,20 1,20 Z M4,13 17,13 17,18 4,18 4,13Z"></Path>
                            <Path Fill="White" Stroke="Black" StrokeThickness="0.3"
                              Data="M8,2 13,2 13,10 8,10 Z"></Path>
                            <Path Stroke="White"
                              Data="M5,14.5 16,14.5 M5,16.5 16,16.5"></Path>

                        </Grid>
                    </Button>
                </StackPanel>
                <TextBox TextAlignment="Center" Margin="0,2,0,2" 
                     FontSize="15" Background="White" 
                     Text="{Binding SelectedPlaylistName}">
                </TextBox>
                <ListView Height="230" ItemsSource="{Binding Songs}">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="120"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{Binding Title}"/>
                                <Label Grid.Column="1" Content="{Binding Duration}"/>
                            </Grid>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackPanel>
            <Border Grid.Row="3" Grid.ColumnSpan="2" Background="{DynamicResource MyBackTitleBrush}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="5*"/>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*"></RowDefinition>
                        <RowDefinition Height="5*"/>
                    </Grid.RowDefinitions>
                    <Slider Grid.ColumnSpan="3" IsManipulationEnabled="True" Style="{DynamicResource MySongSlider}"
                        IsMoveToPointEnabled="False" VerticalAlignment="Top" Height="25" MinHeight="20" 
                        BorderBrush="Black" HorizontalAlignment="Stretch" Grid.Column="1" Margin="1,0,0,0"></Slider>
                    <StackPanel Grid.Column="2" Grid.RowSpan="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                        <Button Height="40" Width="20" VerticalAlignment="Top" Margin="3">
                            <Path Fill="White" Data="M0,5 5,0 5,5 10,0 10,10 5,5 5,10 0,5"
                              HorizontalAlignment="Center" VerticalAlignment="Center"
                              Stroke="Black"/>
                        </Button>
                        <Button Height="40" Width="40" VerticalAlignment="Center" Margin="3">
                            <Rectangle Height="20" Width="20" Fill="White" Stroke="Black"/>
                        </Button>
                        <Button Height="40" Width="40" VerticalAlignment="Center" Margin="3" >
                            <Path Data="M 0,0 20,12 0,24 0,0" Fill="White"
                              Stroke="Black"
                              HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Button>
                        <Button Height="40" Width="20" VerticalAlignment="Top" Margin="3">
                            <Path Fill="White" HorizontalAlignment="Center" VerticalAlignment="Center"
                              Data="M0,0 5,5 5,0 10,5 5,10 5,5 0,10 V 0 "
                              Stroke="Black"/>
                        </Button>
                    </StackPanel>
                    <Button Height="30" Width="30" HorizontalAlignment="Center" Margin="6,9,38,0" Name="mnWindow_btn" 
                        Padding="0,4,0,0" VerticalAlignment="Top" Grid.Row="1" Click="MnWindowBtnClick">
                        <Path Fill="White" Stroke="Black" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Path.Data>
                                <PathGeometry>
                                    <PathFigure IsClosed="True" StartPoint="0,0">
                                        <LineSegment Point="12,0"/>
                                        <LineSegment Point="9,3"/>
                                        <BezierSegment Point1="6,7" Point2="17,6" Point3="12,17"/>
                                        <LineSegment Point="7,17"/>
                                        <BezierSegment Point1="5,17" Point2="10,11" Point3="4,8"/>
                                        <LineSegment Point="0,12"/>
                                    </PathFigure>
                                </PathGeometry>
                            </Path.Data>
                        </Path>
                    </Button>
                    <TextBlock FontSize="15" Foreground="Black" Margin="0,-1,75,1" Text="00:00:00" TextAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBlock FontSize="15" Foreground="{DynamicResource MyTextGradientLightResource}" Margin="0,-1,-1,0" Text="00:00:00" TextAlignment="Center" Grid.Column="4" />
                </Grid>
            </Border>
            <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal">
                <TreeView Width="150" Margin="5,0,0,0" >
                    <TreeViewItem IsExpanded="True" Header="Music">
                        <TreeViewItem Header="Albums"></TreeViewItem>
                        <TreeViewItem Header="Artists"></TreeViewItem>
                        <TreeViewItem Header="Genres"></TreeViewItem>
                    </TreeViewItem>
                    <TreeViewItem Header="Playlists" IsExpanded="True">
                        <ListView BorderThickness="0" ItemsSource="{Binding Playlists}" 
                              SelectedItem="{Binding SelectedPlaylist}">
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding PlaylistName}"></TextBlock>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </TreeViewItem>
                </TreeView>
                <ListView Margin="5,0,0,0" Width="320" ItemsSource="{Binding Songs}">
                    <ListView.View>
                        <GridView AllowsColumnReorder="True" >
                            <GridViewColumn Header="Title" Width="100" DisplayMemberBinding="{Binding Title}"/>
                            <GridViewColumn Header="Artist" Width="90" DisplayMemberBinding="{Binding ArtistName}"/>
                            <GridViewColumn Header="Duration" Width="60" DisplayMemberBinding="{Binding Duration}"/>
                        </GridView>
                    </ListView.View>
                </ListView>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>
